const express = require('express')
const app = express()
app.get('/', (req, res) => {
    res.end('112222222')
})

app.get('/qq', (req, res) => {
    // res.end('qqq')
    //console.log(req.query.name, 888)
    var arr = [
        { id: 1, name: 'jack' },
        { id: 2, name: 'jack2' },
        { id: 3, name: 'jack' },
        { id: 4, name: 'jack3' },
    ]
    var newArr = arr.filter(item => item.name == req.query.name)
    console.log(newArr, 9999)

    res.send(newArr)
})

app.get('/aa/:ids/:name', (req, res) => {
    console.log(req.params,9999)
    var arr = [
        { id: 1, name: 'jack' },
        { id: 2, name: 'jack2' },
        { id: 3, name: 'jack' },
        { id: 4, name: 'jack3' },
    ]
    var newArr = arr.filter(item => item.id == req.params.ids)
    res.send(newArr)
})


app.post('/qq', (req, res) => {
    // res.end('qqq')
    //console.log(req, 888)
    res.send('post')
})

app.listen(3001, '192.168.75.143', () => {
    console.log('服务器：http://192.168.75.143:3001')
})


